package com.sihai.ehr.web.action.authority;

import com.sihai.core.LimitedList;
import com.sihai.core.beans.BeanInject;
import com.sihai.ehr.model.biz.AuditType;
import com.sihai.ehr.model.biz.Auditing;
import com.sihai.ehr.model.biz.AuditingBase;
import com.sihai.ehr.model.biz.EmployeeinfoWork;
import com.sihai.ehr.model.sys.Organization;
import com.sihai.ehr.model.sys.OrganizationAuditing;
import com.sihai.ehr.service.AuditBaseService;
import com.sihai.ehr.service.AuditService;
import com.sihai.ehr.service.EmployeeService;
import com.sihai.ehr.service.OrganizationService;
import com.sihai.ehr.utils.StringUtil;
import com.sihai.ehr.web.action.EHRAction;
import com.sihai.ehr.web.pojo.AuditConfig;
import com.sihai.ehr.web.pojo.StaffSearchPojo;
import org.apache.commons.lang.StringUtils;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: wxn
 * @since: 12-7-15 下午13:53
 *
 * 审核Action
 */

@Results({
        @Result(name = "audit_org_list", type = "redirect", location = "/organization/audit_list_main.xhtml"),
        @Result(name = "list", type = "redirect", location = "${currentAuditAction}")
})
public class AuditBaseAction extends EHRAction {
    @BeanInject
    private AuditBaseService auditBaseService;

    private AuditingBase auditing;

    //审核
    @Action("/authority/audit-base")
    public String audit() throws Exception {
        if(auditing == null || auditing.getId() == null || auditing.getId() <= 0){
            return "list";
        }

        auditBaseService.saveAuditing(auditing, currentAuditType);

        return "list";
    }

    public AuditingBase getAuditing() {
        return auditing;
    }

    public void setAuditing(AuditingBase auditing) {
        this.auditing = auditing;
    }
}
